package com.designmodel.designmodel.OBERRVER_Pattern_观察者模式.service.impl;

import java.util.Observable;
import java.util.stream.IntStream;

/**
 * 被观察者
 */
public class Subject extends Observable {

	private int value;

	public int getValue() {
		return value;
	}

	public void setValue(int value) {
		this.value = value;
	}

	public void  progress(){
		IntStream.range(0,1).forEach(i->{
			this.value=i;
			super.setChanged();
			//通知观察者,改变的数据对象是什么,有参数主动push,没参数被动push
			super.notifyObservers("1");
		});
	}



}
